package com.djmw.mouse.repository;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.djmw.mouse.entity.Bookmark;
import com.djmw.mouse.entity.BookmarkId;

public interface BookmarkDao extends PagingAndSortingRepository<Bookmark, BookmarkId>,
JpaSpecificationExecutor<Bookmark> {

    @Query("select bookmark from Bookmark bookmark where bookmark.pk.position.id = ?1 and bookmark.pk.memberUser.id = ?2")
    Bookmark findExistingPositionBookmark(Long positionId, Long memberUserId);

    @Query("select bookmark from Bookmark bookmark where bookmark.pk.company.id = ?1 and bookmark.pk.memberUser.id = ?2")
    Bookmark findExistingCompanyBookmark(Long companyId, Long memberUserId);

    // @Query("select Application application where pk.memberUser.id = ?1")
    // List<Application> findByMemberUserId(Long memberUserId);
}
